<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="referrer" content="never">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--     上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！-->
    <title>毕设:教职工健康信息管理系统</title>
    <!--     Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <title>Title</title>
</head>
<style>

    .f {
        text-align: center;
    }

</style>
<body>
<h1 class="f">教职工健康信息管理系统</h1>

<div class="f">
    <button onclick="doAjaxChaxun()">员工健康信息表</button>
    <button onclick="doAjaxAdd()">添加职工健康信息</button>
    <button onclick="guanliChaxun()">管理员列表</button>
    <button onclick="guanliAddUI()">添加管理员</button>
    <button onclick="guanlimima()">修改密码</button>
    <!--         <button onclick="doAjaxChaxun()" >我的信息</button>-->
    <button onclick="rizhiChaxun()">日志</button>


    <span class="f" id="Ajax">

<div class="f">
<!--<img src="./bs-logo2.jpg">-->
<span>
 <form class="form-inline">
    <div class="form-group">
        <input type="text" name="name" class="form-control" placeholder="输入姓名查询职工健康信息">
    </div>
    <button type="button" onclick="doSearch()" class="btn btn-primary btn-sm">查询</button>

 </form>
 <table width="50%" class="table table-striped">
    <thead>
    <h1> <th class="f">职工id</th>
        <th class="f">姓名</th>
        <th class="f">性别</th>
        <th class="f">年龄</th>
    </h1>
    </thead>
    <tbody>
    <tr th:each="zhigong:${zhigonglist}">
          <td th:text="${zhigong.id}">null</td>
        <td th:text="${zhigong.name}">null</td>
        <td th:text="${zhigong.xingbie}">null</td>
        <td th:text="${zhigong.nianing}">null</td>
        <td><a th:href="@{/lgbs/xiangqing/{id}(id=${zhigong.id})}">详情</a></td>
       <td><a onclick="return confirm('确定要删除吗？');" th:href="@{/lgbs/doDeleteById/{id}(id=${zhigong.id})} ">删除</a></td>
    </tr>
    </tbody>

</table>
    </span>
 </div>



</span>

</div>
<script src="../static/js/jquery.min.js"></script>
<script>
    function doSearch() {
        //console.log("doSearch()");
        //获取form表单中的数据
        let name = document.forms[0].name.value;
        //console.log("name",name);
        //定义url
         let url = `http:/lgbs/homepage/${name}`;//rest
        // //访问对应的url (这种形式的访问将来会改成异步)
        location.href = url;
// $.ajax(function () {
//     let name = document.forms[0].name.value;
//     // let rl = `http:/lgbs/homepage/${name}`;
//     type:"get";
//     url:`http:/lgbs/homepage/${name}`;
// })
    }

    //添加页面
    function doAjaxAdd() {
        let xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                    document.getElementById("Ajax").innerHTML = xhr.responseText;
                }
            }
        }
        let url = "http://localhost/lgbs/zhigomhAddUI";
        xhr.open("Get", url, true)
        xhr.send(null)
    }

    //查询员工列表
    function doAjaxChaxun() {
        let xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                    document.getElementById("Ajax").innerHTML = xhr.responseText;
                }
            }
        }
        let url = "http://localhost/lgbs/chaxunzhigong";
        xhr.open("Get", url, true)
        xhr.send(null)
    }

    //管理员查询
    function guanliChaxun() {
        let xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                    document.getElementById("Ajax").innerHTML = xhr.responseText;
                }
            }
        }
        let url = "http://localhost/lgbs//guanlichaxun";
        xhr.open("Get", url, true)
        xhr.send(null)
    }

    //添加管理员
    function guanliAddUI() {
        let xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                    document.getElementById("Ajax").innerHTML = xhr.responseText;
                }
            }
        }
        let url = "http://localhost/lgbs//guanliAddUI";
        xhr.open("Get", url, true)
        xhr.send(null)
    }

    //添加管理员
    function guanlimima() {
        let xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                    document.getElementById("Ajax").innerHTML = xhr.responseText;
                }
            }
        }
        let url = "http://localhost/lgbs//guanlimima";
        xhr.open("Get", url, true)
        xhr.send(null)
    }

    //日志查询
    function rizhiChaxun() {
        let xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                    document.getElementById("Ajax").innerHTML = xhr.responseText;
                }
            }
        }
        let url = "http://localhost/lgbs//rizhiChaxun";
        xhr.open("Get", url, true)
        xhr.send(null)
    }

    //测试按钮数据
    // function test(name) {
    //     $.ajax({
    //         method:"get",
    //         url:`http/localhost/lgbs/test?name=${name}`,
    //         success(result){
    //             alert(result)
    //         }
    //     })
    //
    // }

</script>
</body>

</html>